package com.dc.refactoring._6_处理概括关系._10_FormTemplateMethod.step3;

import com.dc.refactoring._0_入门.Rental;

public abstract class Statement {

    // step 1 将 函数上移（子类中实现的函数需要声明为 abstract）

    /**
     * 打印会话
     */
    public String value(Customer customer) {
        String result = headerString(customer);
        for (Rental rental : customer.getRentals()) {
            // 展示电影明细
            result += eachRentalString(rental);
        }
        result += footerString(customer);
        return result;
    }

    protected abstract String headerString(Customer customer);

    protected abstract String eachRentalString(Rental rental);

    protected abstract String footerString(Customer customer);


}
